class Moment {
  final String id;
  final String content;
  final String createdTime;
  final bool isFavorite;
  final String? title;

  Moment({
    required this.id,
    required this.content,
    required this.createdTime,
    this.isFavorite = false,
    this.title,
  });

  factory Moment.fromJson(Map<String, dynamic> json) {
    return Moment(
      id: json['id'].toString(),
      content: json['content'] as String,
      createdTime: json['createdTime'] as String,
      isFavorite: json['isFavorite'] as bool? ?? false,
      title: json['title'] as String?,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'content': content,
      'createdTime': createdTime,
      'isFavorite': isFavorite,
      'title': title,
    };
  }
}
